package ihm.controller;

import com.icesoft.faces.component.paneltabset.TabChangeEvent;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;

import javax.faces.event.AbortProcessingException;

@ManagedBean
public class TabChangeListener implements com.icesoft.faces.component.paneltabset.TabChangeListener{

     @ManagedProperty(value = "#{clientController}")
    private ClientController clientController;

    @Override
    public void processTabChange(TabChangeEvent tce) throws AbortProcessingException {
        System.out.println("__________________________" +tce.getNewTabIndex());
       if (tce.getNewTabIndex() == 1){
          clientController.setPage("questionnairesOuverts");
          clientController.setQuestionnaire(null);
       }
    }

    public void setClientController(ClientController clientController) {
        this.clientController = clientController;
    }


}
